<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib uri="http://richfaces.org/a4j" prefix="a4j"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<f:view>

    <link href="/general/css/admin_1.css" rel="stylesheet" type="text/css"/>

    <h:form>
        <br/>
        <h:panelGrid columns="1" width="100%" styleClass="tablaprincipal">
            <h:outputLabel value="Registrar pagina"/>
        </h:panelGrid>
        <a4j:outputPanel ajaxRendered="true">
            <h:messages id="lblMessages" styleClass="messages" infoClass="infoClass" errorClass="errorClass"
                        warnClass="warnClass" showDetail="true" errorStyle="color:red;"
                        warnStyle="color:green;" infoStyle="color:black;" fatalStyle="color:black"/>
        </a4j:outputPanel>

        <h:panelGrid columns="2" styleClass="tablanormal">
            <h:outputLabel value="Seleccione:"/>
            <h:selectOneMenu value="#{MenuController.esPagina}" onchange="submit();" >
                <f:selectItem itemLabel="Menu" itemValue="false" />
                <f:selectItem itemLabel="Pagina" itemValue="true" />
            </h:selectOneMenu>

            <h:outputLabel value="Módulo:"/>
            <h:selectOneMenu value="#{MenuController.modCodigo}" onchange="submit();">
                <f:selectItems value="#{ModuloController.comboModulo}" />
            </h:selectOneMenu>

            <h:outputLabel value="Menú:"/>
            <h:panelGrid columns="2" styleClass="tablanormal">
                <h:selectOneMenu value="#{MenuController.menu.fkMenCodigoPadre}" rendered="#{MenuController.esPagina==true}">
                    <f:selectItems value="#{MenuController.comboMenu}" />
                </h:selectOneMenu>
                <h:inputText value="#{MenuController.menu.menNombre}" rendered="#{MenuController.esPagina==false}"/>
            </h:panelGrid>

            <h:outputLabel value="Sub Menu: " rendered="#{MenuController.esPagina==true}" />
            <h:inputText value="#{MenuController.menu.menNombre}" rendered="#{MenuController.esPagina==true}" size="50" maxlength="50"/>

            <h:outputLabel value="Ruta Pagina: " rendered="#{MenuController.esPagina==true}"/>
            <h:panelGrid columns="2" styleClass="tablanormal">
                <h:inputText value="#{MenuController.menu.menrutaPagina}" rendered="#{MenuController.esPagina==true}" size="80" maxlength="80"/>
                <h:outputLabel value="(Ejm. carpeta/archivo.jsp)" styleClass="desactivar" rendered="#{MenuController.esPagina==true}" />
            </h:panelGrid>

            <h:outputLabel value="Orden:" />
            <h:inputText value="#{MenuController.menu.menOrden}" size="5" maxlength="5" />

            <h:outputLabel value="Descripción:" />
            <h:inputTextarea value="#{MenuController.menu.menDescripcion}" rows="3" cols="30" />

        </h:panelGrid>
            
        <h:commandButton action="#{MenuController.guardar}" value="Grabar" styleClass="desactivar" />
        <h:commandButton action="#{MenuController.listar}" value="Cancelar" styleClass="desactivar" />
        
    </h:form>
</f:view>